import React, { Suspense, useEffect, useRef } from 'react';
import Routers from './routers';
import PageLoading from './components/loading';

function App() {
    const timer = useRef<any>(null);
    useEffect(() => {
        // JavaScript部分  
let lastScrollPosition = 0;  
window.addEventListener('scroll', function() {  
    console.log('eeee');
    
    const currentScrollPosition = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;  
    if (currentScrollPosition > lastScrollPosition) {  
        // 向下滚动  
        document.body.classList.add('scroll-active');  
    } else {  
        // 向上滚动或静止  
        document.body.classList.remove('scroll-active');  
    }  
    lastScrollPosition = currentScrollPosition;  
});
    }, []);
    return (
        <div className="App" style={{ height: '100%' }}>
            <Suspense fallback={<PageLoading />}>
                <Routers />
            </Suspense>
        </div>
    );
}

export default App;
